package com.hwpt.hwaccount.feature.auth;

import android.widget.Button;

import com.hwpt.hwaccount.core.base.BaseContract;

public interface AuthContract {

    interface View extends BaseContract.View {
        void switchTab(boolean isLogin);
        void updateTabUI();
        void updateLoginTypeUI();
        void updateRegisterFormUI();
        void startCountDown(Button button, long millisUntilFinished);
        void resetButton(Button button);
        void navigateToRepwdActivity();
        void navigateToHomeActivity();
        void finishActivity();
        void showPhoneError(String error);
        void showAccountError(String error);
        void displayRegisterPhone(String phone);
        void setLoginAccount(String account);


        String getLoginAccount();
        String getVerifyCode();
        String getPassword();
        String getRegisterPhone();
        String getRegisterVerifyCode();
        String getSetPassword();
        String getConfirmPassword();
        Button getRegisterVerifyCodeButton();
    }

    interface Presenter extends BaseContract.Presenter<View> {
        void onTabSelected(boolean isLogin);
        void onSwitchLoginType();
        void onForgetPassword();
        void onPrivacyClicked();
        void onSkipClicked();
        void onGetVerifyCode(Button button);
        void onLogin();
        void RegisterVerifyCode();
        void onRegister();
        void resetRegisterState();

        boolean isLoginTabSelected();
        boolean isVerifyCodeLogin();
        boolean isRegisterFirstStep();
    }

    interface Model extends BaseContract.Model {
        boolean validatePhone(String phone);
        boolean validateAccount(String account);
        boolean validatePassword(String password);
        boolean validateVerifyCode(String verifyCode);
        boolean validateRegister(String password, String confirmPassword);

        void RegisterSendCode(String phone, AuthContract.Model.VerifyCodeCallback callback);
        void RegisterVerifyCode(String phone, String verifyCode, AuthContract.Model.VerifyCodeCallback callback);
        void LoginSendCode(String phone, AuthContract.Model.VerifyCodeCallback callback);
        void loginWithPwd(String account, String password, LoginCallback callback);
        void register(String phone, String verifyCode, String password, RegisterCallback callback);
        void loginWithVerifyCode(String phone, String verifyCode, AuthContract.Model.VerifyCodeCallback callback);

        interface VerifyCodeCallback {
            void onSuccess();
            void onFailure(String error);
        }

        interface LoginCallback {
            void onSuccess(String response);
            void onFailure(String error);
        }

        interface RegisterCallback {
            void onSuccess(String response);
            void onFailure(String error);
        }

        interface TestUserCallback {
            void onSuccess();
            void onFailure(String error);
        }
    }
}